import base64

open_icon = open("sqks.ico", "rb")
b64str = base64.b64encode(open_icon.read())
open_icon.close()

write_data = "img = %s" %(b64str)
# print(b64str)

f = open("sqks.py", "w+")
f.write(write_data)
f.close()

# img = b'......'然后得到一个这个
